package fr.toto.script;

import java.io.PrintStream;

public class ScriptLancher {

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {

		new ScriptLancher("sh", "/home/tomtom/boucle.sh");

	}

	public ScriptLancher(final String pgm, final String arg) {

		
		final String[] cmd = (pgm+"\t"+arg).split("\t");

		new Thread(new Runnable() {
			public void run() {

				ScriptWindow window = new ScriptWindow(pgm + " " + arg);

				ProcessLauncher pl = new ProcessLauncher(window.out, window.err);
				try {

					pl.exec(cmd);

				} catch (Exception e) {
					e.printStackTrace(new PrintStream(window.err));
				}
			}
		}).start();

	}

}
